import {
  createRouter,
  createWebHashHistory,
  type RouteRecordRaw,
} from 'vue-router'

export const publicRouters: RouteRecordRaw[] = [
  {
    path: '/home',
    component: () => import('@/layout/index.vue'),
    redirect: '/edit',

    children: [
      {
        path: '/edit',
        name: 'edit',
        component: () => import('@/views/edit/edit.vue'),
        meta: { title: '编辑', icon: 'shouye', affix: true, sort: '99.99' },
      },
      {
        path: '/connect',
        name: 'connect',
        component: () => import('@/views/connect/index.vue'),
        meta: { title: '连接服务器', icon: 'shouye', affix: true, sort: '99.99' },
      },
      {
        path: '/list',
        name: 'list',
        component: () => import('@/views/list/list.vue'),
        meta: { title: '列表', icon: 'shouye', affix: true, sort: '99.99' },
      },
    ],
    meta: {
      sort: '99',
    },
  },
  {
    path: '/',
    name: 'login',
    component: () => import('@/views/login/login.vue'),
    meta: {
      hidden: '1',
    },
  },
]
const router = createRouter({
  history: createWebHashHistory(),
  routes: publicRouters,
})

export default router
